package org.linkerproject.html;

import org.imlinker.util.StringUtils;

public class HtmlLink extends HtmlElement {

	public HtmlLink(String url) {
		this(url, url);
	}

	public HtmlLink(String title, String url) {
		this.title = title;
		this.url = url;
	}

	@Override
	public String output() {
		StringBuffer temp = new StringBuffer("");

		temp.append("<div><a href=\"");
		temp.append(this.url);
		temp.append("\">");
		if (StringUtils.isEmpty(title)) {
			temp.append(url);
		} else {
			temp.append(this.title);
		}
		temp.append("</a></div>");

		return temp.toString();
	}

	public String getUrl() {
		return url;
	}

	public String getTitle() {
		return title;
	}

	private String url;

	private String title;

}
